<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  exclude-result-prefixes="xsl a l"
> 
   
  <xsl:template match="a:xtheme" mode="a:input-show" name="a:xtheme">    
    <xsl:param name="label"/>
    <xsl:param name="hint"/>
    <xsl:param name="name" select="'xtheme'"/>
    <div class='input text theme'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$label"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:if test="$hint">
            <xsl:call-template name="a:input-hints">
              <xsl:with-param name="hint" select="$hint"/>
            </xsl:call-template>
          </xsl:if>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>                 
        <xsl:apply-templates mode="a:themes-selection">
          <xsl:with-param name='name' select="$name"/>          
        </xsl:apply-templates> 
        <div class="spacer"/>               
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
  
  <xsl:template match="a:options" mode="a:themes-selection">
    <xsl:param name="name"/>
    <div class="themes_select">
      <select name="{$name}">
        <xsl:if test="@count &lt;= 5">
          <xsl:attribute name="size">
            <xsl:value-of select="@count"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates mode="a:theme-select">
          <xsl:sort select="*/@title"/>
        </xsl:apply-templates>
      </select>
      <div class="spacer"/>
    </div>   
  </xsl:template>
  
  <xsl:template match="a:option" mode="a:theme-select">
    <option value="{@key}">
      <xsl:if test="@selected">
        <xsl:attribute name="selected">selected</xsl:attribute>
      </xsl:if>
      <xsl:for-each select="*">        
        <xsl:value-of select="@title"/>
      </xsl:for-each>
    </option>
  </xsl:template>
  
  <!-- xsl:template match="a:option" mode="a:theme-radio-select">
    <xsl:param name="selected"/>
    <xsl:param name="name"/>
    <xsl:variable name="key" select="@key"/>
    <xsl:for-each select="*">
      <div class="theme_select">
        <div class="title">     
          <input name="{$name}" type="radio" value="{$key}">
            <xsl:if test="$key=$selected">
              <xsl:attribute name="checked">checked</xsl:attribute>
            </xsl:if>
          </input>   
          <span><xsl:value-of select="a:title"/></span>
          <div class="spacer"/>
        </div>        
        <div class="description">
          <span><xsl:value-of select="a:description"/></span>
          <div class="spacer"/>
        </div>
        <xsl:if test="a:depiction/@uri">
          <div class="preview_thumb">
            <img src="{a:format-static-url(a:public-static-url(a:depiction/@uri))}"/>
            <div class="spacer"/>
          </div>        
        </xsl:if>
        <div class="spacer"/>
      </div>    
    </xsl:for-each>    
  </xsl:template -->
  
</xsl:stylesheet>

